<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/qrcode.min.js"></script>
	<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
</head>
<body>
	<div id="qrcode" ></div>
	<script type="text/javascript">
		//显示二维码
		new QRCode(document.getElementById("qrcode"), "${code_url}");

		//轮询订单是否支付成功
		var t1 = window.setInterval('queryStatus()', 5000);

		function queryStatus(){
			$.ajax({
				type: 'post',
				url: 'WxPayOrderQueryServlet',
				data: {orderNO:"${orderNO}"},
				success: function(str){
					console.log(str);
					if('SUCCESS' == str){
						location.href='success.jsp?orderNO=${orderNO}';
					}
				},
				error: function(){
					alert('执行错误！');
				}
			});
		}

	</script>
</body>
</html>